<template>
  <div class="content-block block-half-2">
    <div class="info-head">{{ title }}</div>
    <div class="info-content">
      <v-chart
        :option="chartOption" style="width: 100%;height: 500px;"
        :theme="chartTheme" autoresize
      ></v-chart>
    </div>
  </div>
</template>

<script>
import MixinVchartTheme from '@/mixins/mixin-vchart-theme';

export default {
  name: 'grid-item-two',
  mixins: [MixinVchartTheme],
  props: {
    title: String,
    info: {
      type: Array,
      default () {
        return []
      }
    }
  },
  computed: {
    chartOption () {
      return {
        legend: {
          bottom: '6%'
        },
        tooltip: {
          trigger: 'item',
        },
        series: [
          {
            name: this.title,
            type: 'pie',
            radius: [80, 130],
            center: ['50%', '50%'],
            itemStyle: {
              borderRadius: 8
            },
            data: this.info
          }
        ]
      }
    }
  }
}
</script>

<style scoped>

</style>
